package day11.handler.simpleChannelHandler.response;

import day11.packet.response.JoinGroupResponsePacket;
import day11.util.session.GroupSession;
import day11.util.session.Session;
import day11.util.session.SessionUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenshijie
 * @date 2024/1/2 14:28
 */

public class JoinGroupResponseHandler extends SimpleChannelInboundHandler<JoinGroupResponsePacket> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, JoinGroupResponsePacket joinGroupResponsePacket) throws Exception {
        if (joinGroupResponsePacket.isSuccess()) {
            System.out.println("加入群【" + joinGroupResponsePacket.getGroupId() + "】成功");
            System.out.println(joinGroupResponsePacket.getMessage());
        } else {
            System.err.println("加入群【" + joinGroupResponsePacket.getGroupId() + "】失败。请重新检查群号是否输入正确。");
        }
    }
}
